# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=miraclecast
pkgver=1.0_git20221016
pkgrel=0
_commit="380504b0f833faa46f12d3a1f3861b97d08d32a4"
pkgdesc="Connect external monitors to your system via Wifi-Display specification also known as Miracast"
url="https://github.com/albfan/miraclecast"
arch="all"
license="LGPL-2.1-or-later AND LGPL-2.0-or-later AND GPL-2.0-only"
makedepends="
	meson
	elogind-dev
	eudev-dev
	glib-dev
	readline-dev
	samurai
	"
subpackages="$pkgname-bash-completion"
source="https://github.com/albfan/miraclecast/archive/$_commit/miraclecast-$_commit.tar.gz"
builddir="$srcdir/$pkgname-$_commit"

build() {
	abuild-meson \
		. output \
		-Denable-systemd=false \
		-Dbuild-tests=true
	meson compile -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	mkdir -p "$pkgdir"/usr/share/dbus-1/system.d
	mv \
		"$pkgdir"/etc/dbus-1/system.d/org.freedesktop.miracle.conf \
		"$pkgdir"/usr/share/dbus-1/system.d/
	rm -r "$pkgdir"/etc/dbus-1
}

sha512sums="
b3a91cffa36cdfff3db9cd080d1ccf549188cf26a01d2f795b0262e9c7e621b9bc9bdf1e606c38b4051381dac8295f7dc9561b77601db29ac520eadd237c2003  miraclecast-380504b0f833faa46f12d3a1f3861b97d08d32a4.tar.gz
"
